<?php

/**
 * default actions.
 *
 * @package    visa
 * @subpackage default
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class defaultActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
	  // DEFAULT
	  $this->navbars = vtnsSlot::getNavBars();
	  $this->rightBlocks = vtnsSlot::getRightBlocks();
	  $this->menuBottoms = vtnsSlot::getMenuBottoms();
	  $this->bottom = vtnsSlot::getBottom();
	  
	  
	  // Get Img for slide
	  $q = Doctrine_Query::create()
			->from("VTNSCms c")
			->addWhere("c.cms_category_id = 24")
			->orderBy("updated_at");
	$this->slides = $q->fetchArray();
	  
	  $q = Doctrine_Query::create()
	  		->from("VTNSCmsCategory c")
			->where("cms_type = 5")
			->addWhere("template = 3")
			->orderBy("position");
			
	  $homeCmsCategoryList = $q->fetchArray();
	  foreach ($homeCmsCategoryList as $key => $homeCmsCategory)
	  {
		  $c = Doctrine_Query::create()
		  		->from("VTNSCms c")
				->where("cms_category_id = ?", $homeCmsCategory['cms_category_id']);
		  $homeCmsCategoryList[$key]['cms_array'] = $c->fetchArray();
	  }
	  $this->homeCmsCategoryList = $homeCmsCategoryList;
	  
	  $q = Doctrine_Query::create()
	  		->from("VTNSCmsCategory c")
			->where("cms_type = 5")
			->addWhere("template = 0")
			->addWhere("alias LIKE 'home_%'")
			->orderBy("position");
	  $homeCmsCategoryDefault = $q->fetchArray();
	  foreach ($homeCmsCategoryDefault as $key => $homeCmsCategory)
	  {
		  $c = Doctrine_Query::create()
		  		->from("VTNSCms c")
				->where("cms_category_id = ?", $homeCmsCategory['cms_category_id']);
		  $homeCmsCategoryDefault[$key]['cms_array'] = $c->fetchArray();
	  }
	  $this->homeCmsCategoryDefault = $homeCmsCategoryDefault;
	  
	  $this->faq_category = Doctrine_Core::getTable("VTNSCmsCategory")->findOneByAlias("dich-vu-lap-dat");
	  $qfaq = Doctrine_Query::create()
	  			->from("VTNSCms c")
				->where("cms_category_id = ?", $this->faq_category->cms_category_id)
				->limit(4);
	  $this->faqs = $qfaq->fetchArray();
	  
	  return SfView::SUCCESS;
  }
}
